unit RilLmControls;

interface

uses Windows, Ril, RilLmClasses, Classes, Controls;

type
  TRilControl = class(TRilComponent, IControl)
  private
    FControl: TControl;
  protected
    function GetHeight: Integer; 
    function GetLeft: Integer;
    function GetTop: Integer;
    function GetVisible: Boolean;
    function GetWidth: Integer;
    procedure SetHeight(const Value: Integer);
    procedure SetLeft(const Value: Integer);
    procedure SetTop(const Value: Integer);
    procedure SetVisible(const Value: Boolean);
    procedure SetWidth(const Value: Integer);
    procedure Show; 
  public
    constructor Create(AComponent: TComponent); override;
  end;

  TRilWinControl = class(TRilControl, IWinControl)
  private
    FWinControl: TWinControl;
  protected
    function GetHandle: HWnd;
    function GetParentWindow: HWnd;
    procedure SetParentWindow(const Value: HWnd);
  public
    constructor Create(AComponent: TComponent); override;
  end;

implementation

constructor TRilControl.Create(AComponent: TComponent);
begin
  inherited Create(AComponent);
  FControl := AComponent as TControl;
end;

{ TRilControl }

function TRilControl.GetHeight: Integer;
begin
  Result := FControl.Height;
end;

function TRilControl.GetLeft: Integer;
begin
  Result := FControl.Left;
end;

function TRilControl.GetTop: Integer;
begin
  Result := FControl.Top;
end;

function TRilControl.GetVisible: Boolean;
begin
  Result := FControl.Visible;
end;

function TRilControl.GetWidth: Integer;
begin
  Result := FControl.Width;
end;

procedure TRilControl.SetHeight(const Value: Integer);
begin
  FControl.Height := Value;
end;

procedure TRilControl.SetLeft(const Value: Integer);
begin
  FControl.Left := Value;
end;

procedure TRilControl.SetTop(const Value: Integer);
begin
  FControl.Top := Value;
end;

procedure TRilControl.SetVisible(const Value: Boolean);
begin
  FControl.Visible := Value;
end;

procedure TRilControl.SetWidth(const Value: Integer);
begin
  FControl.Width := Value;
end;

procedure TRilControl.Show;
begin
  FControl.Show;
end;

constructor TRilWinControl.Create(AComponent: TComponent);
begin
  inherited Create(AComponent);
  FWinControl := AComponent as TWinControl;
end;

{ TRilWinControl }

function TRilWinControl.GetHandle: HWnd;
begin
  Result := FWinControl.Handle;
end;

function TRilWinControl.GetParentWindow: HWnd;
begin
  Result := FWinControl.ParentWindow;
end;

procedure TRilWinControl.SetParentWindow(const Value: HWnd);
begin
  FWinControl.ParentWindow := Value;
end;

end.
